//Write by oshogbo//vx
//23.07.2011
//http://code.google.com/p/streamobs

import javax.swing.*;
import java.awt.*;

class TimeSetting extends JComboBox
{
  private static final long serialVersionUID = 1L;
  private static final String times[] = { "5 second", "30 second", "1 minute", "5 minutes", "15 minutes", "30 minutes", "60 minutes" };

  public TimeSetting()
  {
    super(times);
  }

  public int getTime()
  {
    String sel = (String)getSelectedItem();
    String time[] = sel.split(" ");

    int number = Integer.parseInt(time[0]);
    int mul = 1;

    switch(time[1].charAt(0))
    {
      case 'h': mul *= 60;
      case 'm': mul *= 60;
      case 's': mul *= 1000;
    }

    return number * mul;
  }
}
